cmake_minimum_required(VERSION 3.5) # CMake install : https://cmake.org/download/
project(GraphicsTool LANGUAGES CXX RC)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_PREFIX_PATH "E:/softwarepath/Qt/5.15.2/mingw81_64") # Qt Kit Dir
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5 COMPONENTS Widgets Core Gui REQUIRED) # Qt COMPONENTS
find_package(Qt5 REQUIRED COMPONENTS Core)
# 添加OpenGL库
#find_package(OpenGL REQUIRED)
aux_source_directory(./src srcs)
#添加资源文件
qt5_add_resources(RESOURCES_RCC ${CMAKE_SOURCE_DIR}/resources/resources.qrc)

# 添加 GUI 模块的私有头文件路径
include_directories(${Qt5Core_PRIVATE_INCLUDE_DIRS}
    ${Qt5Gui_PRIVATE_INCLUDE_DIRS}  # 明确添加 GUI 私有路径
)
include_directories(
    E:/git/other-sdk/ElaWidgetTools/include
    E:/git/other-sdk/QXlsx/include
)

# Specify MSVC UTF-8 encoding   
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")

add_executable(${PROJECT_NAME}
    WIN32 # If you need a terminal for debug, please comment this statement
    ${RESOURCES_RCC}
    resources/ico.rc
    src/common.h
    src/crectandpos.cpp
    src/crectandpos.h
    src/GraphicsTool.cpp
    src/GraphicsTool.h
    src/main.cpp
    src/marsspace.cpp
    src/marsspace.h
    src/T_BasePage.cpp
    src/T_BasePage.h
    src/T_CustomRectItem.cpp
    src/T_CustomRectItem.h
    src/T_GridScene.cpp
    src/T_GridScene.h
    src/T_ModuleGroupRectItem.cpp
    src/T_ModuleGroupRectItem.h
    src/T_PaintWidget.cpp
    src/T_PaintWidget.h
    src/T_TipsWidget.cpp
    src/T_TipsWidget.h

    src/t_excel.h
    src/t_excel.cpp


    src/t_result.h
    src/t_result.cpp
    src/savelog.cpp src/savelog.h
    src/t_setparams.h src/t_setparams.cpp
    src/t_blockinfo.h src/t_blockinfo.cpp

    src/t_packinfo.h src/t_packinfo.cpp


) 

#用于调试信息打印控制
#set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE OFF)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "PACK评估软件")  # 生成 

target_link_libraries(${PROJECT_NAME} PRIVATE 
    Qt5::Widgets
    Qt5::Core
    Qt5::Gui) # Qt5 Shared Library

target_link_libraries(${PROJECT_NAME} PRIVATE
    debug E:/git/other-sdk/ElaWidgetTools/lib/mingw810_64/libElaWidgetToolsd.dll.a
    optimized E:/git/other-sdk/ElaWidgetTools/lib/mingw810_64/libElaWidgetTools.dll.a
)

target_link_libraries(${PROJECT_NAME} PRIVATE
    debug E:/git/other-sdk/QXlsx/lib/mingw810_64/libQXlsxd.a
    optimized E:/git/other-sdk/QXlsx/lib/mingw810_64/libQXlsx.a
)

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
    SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/debug)
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
    SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/release)
endif()
